/*
 * AGenView.java
 */
package agen;

import agen.mutacion.Mutacion;
import agen.optimalidad.Optimo;
import agen.util.AHPTableModel;
import agen.util.GenesTableModel;
import agen.util.IndividuoTableModel;
import agen.util.SlideBarGroup;
import agen.util.graficos.ArmarDataSets;
import agen.util.graficos.XYChart;
import java.awt.Color;
import java.awt.Cursor;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.JToggleButton;
import org.jdesktop.application.Action;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.TaskMonitor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
import java.util.Vector;
import javax.swing.Timer;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JFrame;//comentario al pedo
import javax.swing.JPanel;
import javax.swing.JSlider;
import javax.swing.JTextField;
import org.omg.PortableInterceptor.DISCARDING;

/**
 * The application's main frame.
 */
public class AGenView extends FrameView {

    private boolean matrizDefinida = false;
    int[][] eltosIndivPos;
    int[] multiPunto = new int[0];
    int metodoMutacion = Mutacion.SIMPLE;

    public AGenView(SingleFrameApplication app) {
        super(app);

        initComponents();
        inicializarControles();

        // status bar initialization - message timeout, idle icon and busy animation, etc
        ResourceMap resourceMap = getResourceMap();
        int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
        messageTimer = new Timer(messageTimeout, new ActionListener() {

            public void actionPerformed(ActionEvent e) {
//                statusMessageLabel.setText("");
            }
        });
        messageTimer.setRepeats(false);
        int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
        for (int i = 0; i < busyIcons.length; i++) {
            busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
        }
        busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
             //   statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
            }
        });
        idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
//        statusAnimationLabel.setIcon(idleIcon);
//        progressBar.setVisible(false);

        // connecting action tasks to status bar via TaskMonitor
        TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
        taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() {

            public void propertyChange(java.beans.PropertyChangeEvent evt) {
//                String propertyName = evt.getPropertyName();
//                if ("started".equals(propertyName)) {
//                    if (!busyIconTimer.isRunning()) {
//                        statusAnimationLabel.setIcon(busyIcons[0]);
//                        busyIconIndex = 0;
//                        busyIconTimer.start();
//                    }
//                    progressBar.setVisible(true);
//                    progressBar.setIndeterminate(true);
//                } else if ("done".equals(propertyName)) {
//                    busyIconTimer.stop();
//                    statusAnimationLabel.setIcon(idleIcon);
//                    progressBar.setVisible(false);
//                    progressBar.setValue(0);
//                } else if ("message".equals(propertyName)) {
//                    String text = (String) (evt.getNewValue());
//                    statusMessageLabel.setText((text == null) ? "" : text);
//                    messageTimer.restart();
//                } else if ("progress".equals(propertyName)) {
//                    int value = (Integer) (evt.getNewValue());
//                    progressBar.setVisible(true);
//                    progressBar.setIndeterminate(false);
//                    progressBar.setValue(value);
//                }
            }
        });
    }

    @Action
    public void showAboutBox() {
        if (aboutBox == null) {
            JFrame mainFrame = AGenApp.getApplication().getMainFrame();
            aboutBox = new AGenAboutBox(mainFrame);
            aboutBox.setLocationRelativeTo(mainFrame);
        }
        AGenApp.getApplication().show(aboutBox);
    }

    public JCheckBox getChkBuscarEsquema() {
        return chkBuscarEsquema;
    }

    public JLabel getJlblCoherencia() {
        return jlblCoherencia;
    }

    public JLabel getJlblConvergencia() {
        return jlblConvergencia;
    }

    public JLabel getJlblMejorAptitud() {
        return jlblMejorAptitud;
    }

    public JLabel getJlblIteracion() {
        return jlblIteracion;
    }

    /**
     * una vez que se define la matriz podemos dejarle al usuario que use los
     * demás controles.
     */
    private void abilitarControles() {
        if (matrizDefinida) {
            jbtnIncognita.setEnabled(true);
            jbtnTodoIncognita.setEnabled(true);
            lblmanoIncognita.setEnabled(true);
            jbtRandomCompletar.setEnabled(true);
            chkBuscarEsquema.setEnabled(true);
            jsclEstructura.setEnabled(true);
            jtbIGenes.setEnabled(true);
            jtbIndividuo.setEnabled(true);
            jbtCorrer.setEnabled(true);
            jtbMultiCriterio.setEnabled(true);

        }
    }
public void abilitarNavegacion(){
    txtNavegarGen.setEnabled(true);
    jbtNavegarGenAdelante.setEnabled(true);
    jbtNavegarGenAtras.setEnabled(true);
    jbtNavegarGenPrimera.setEnabled(true);
    jbtNavegarGenUltima.setEnabled(true);
}
public void desabilitarNavegacion(){
    txtNavegarGen.setEnabled(false);
    jbtNavegarGenAdelante.setEnabled(false);
    jbtNavegarGenAtras.setEnabled(false);
    jbtNavegarGenPrimera.setEnabled(false);
    jbtNavegarGenUltima.setEnabled(false);
}
    public IndividuoTableModel getJtbIndividuoModel() {
        return (IndividuoTableModel) jtbIndividuo.getModel();
    }

    private void agregarPunto(int[] selectedRows) {
        /*Gracias al selectionMode solo se espera un elemento en el Array*/
        if (multiPunto.length == 0) {
            multiPunto = new int[1];
        } else {
            multiPunto =  Arrays.copyOf(multiPunto, multiPunto.length + 1);
        }
        multiPunto[multiPunto.length - 1] = selectedRows[0];
    }

    private boolean checkearIncognitas() {
        AHPTableModel model = (AHPTableModel) jtbMultiCriterio.getModel();
        if (eltosIndivPos.length > 0){
         for (int j = eltosIndivPos.length - 1; j >= 0; j--) {
                    /*Importante tener en cuenta que la ubicacion debe cargarse al
                     * revez*/
                    model.setValueAt("¿?"
                            , eltosIndivPos[j][0]
                            , eltosIndivPos[j][1] + 1);
//       
            }
        } 
        for (int i = 0; i < model.getRowCount(); i++) {
            for (int j = i + 2; j < model.getColumnCount(); j++) {
                if (model.getValueAt(i, j).equals("¿?")){
                    return true;
                }
            }
        }
        return false;
    }
    private boolean checkearCeldasVacias() {
        AHPTableModel model = (AHPTableModel) jtbMultiCriterio.getModel();
        for (int i = 0; i < model.getRowCount(); i++) {
            for (int j = i + 2; j < model.getColumnCount(); j++) {
                if (model.getValueAt(i, j).equals("")){
                    return true;
                }
            }
        }
        return false;
    }
    /**
     * busca las celdas vacias en la matriz asociada a la tabla Multicriterios
     * y les da un valor aleatorio.
     */
    private void completarAHPConAleatorios() {

        AHPTableModel model = (AHPTableModel) jtbMultiCriterio.getModel();
        model.completandoConRandom = true;
        for (int i = 0; i < model.getRowCount(); i++) {
            for (int j = i + 2; j < model.getColumnCount(); j++) {
                if (model.getValueAt(i, j).equals("")) {
                    /*Completo los vacios con Aleatorios. Util cuando se desea
                    especificar las incognitas sin lenar el resto de las celdas*/
                    model.setValueAt(String.valueOf(
                            AGenApp.calcularPrioridadAleatoria()), i, j);
                }
            }
        }
        model.completandoConRandom = false;
    }

    private void controlarMultiPunto() {
        if (multiPunto.length == 0){
            Random r1 = new Random();
            multiPunto = new int[1];
            multiPunto[0] = r1.nextInt(multiPunto.length);
        }
    }

    /**
     * Recorre la matriz AHP por encima de la diagonal pricipal buscando
     * celdas con el texto "¿?". De Izq a Der y de arriba a abajo. Cada celda
     * con texto "¿?" pasa a ser un elemento del individuo.
     *
     */
    private void generarIndividuo() {
        AHPTableModel model = (AHPTableModel) jtbMultiCriterio.getModel();
        //AGenApp app = AGenApp.getApplication();
        Vector<Integer> filas = new Vector<Integer>();
        Vector<Integer> columnas = new Vector<Integer>();
        for (int i = 0; i < model.getRowCount(); i++) {
            for (int j = i + 2; j < model.getColumnCount(); j++) {
                if (model.getValueAt(i, j).equals("¿?")) {
                    /*Guardo la posicion en que encontre el elto*/
                    filas.add(i);
                    columnas.add(j);
//                    jtbMultiCriterio.getCellRenderer(i, j)
//                            .getTableCellRendererComponent(jtbMultiCriterio, "¿?"
//                            , false, false, i, j).setBackground(Color.CYAN);

                }
            }
        }
        //jtbMultiCriterio.repaint();
        IndividuoTableModel indivModel = new IndividuoTableModel();
        eltosIndivPos = new int[filas.size()][2];
        int elto = 0;
        for (int i = eltosIndivPos.length - 1; i >= 0; i--) {
            /*Lleno al revez porque al usar esta info la uso al revez en
            Aptitud.calcularAptitud*/
            eltosIndivPos[i][0] = filas.get(elto);
            eltosIndivPos[i][1] = columnas.get(elto++) - 1 ;
        }
        indivModel.setEstructura(eltosIndivPos);
        jtbIndividuo.setModel(indivModel);
        jtbMultiPunto.setModel(indivModel);
        /*Por defecto cada elto es un gen.*/
        GenesTableModel genTModel = new GenesTableModel();
        for (int i = 0; i < indivModel.getRowCount(); i++) {
            int[] is = {i};
            genTModel.agregarGen(is);
        }
        jtbIGenes.setModel(genTModel);

    }

/**
 * A veces es conveniente no permitirle al usuario más
 * observar o configurar la matriz dependiendo de:
 *  + Si recien se inicializo la aplicacion.
 *  + Esta corriendo el algoritmo Genético.
 */
    private void deshabilitarControles() {
        
        jbtnIncognita.setEnabled(false);
        jbtnTodoIncognita.setEnabled(false);
        jbtRandomCompletar.setEnabled(false);
        chkBuscarEsquema.setEnabled(false);
        jsclEstructura.setEnabled(false);
        jtbIGenes.setEnabled(false);
        jtbIndividuo.setEnabled(false);
        jbtCorrer.setEnabled(false);
        jtbMultiCriterio.setEnabled(false);
    }

    public AHPTableModel getJtbMultiCriterioModel() {
        return (AHPTableModel) jtbMultiCriterio.getModel();
    }

    private void mostrarIconosFlechas(JLabel label){
        lblmanoGenMatriz.setVisible(label.equals(lblmanoGenMatriz)?true:false);
        lblmanoIncognita.setVisible(label.equals(lblmanoIncognita)?true:false);
        lblmanoTodoIncognita.setVisible(lblmanoIncognita.isVisible());
        lblmanoRandom.setVisible(label.equals(lblmanoRandom)?true:false);
    }

    private void inicializarControles() {
        lblAyudaAHP.setText(AyudaContextual.PASO1_CREAR_MATRIZ);
        mostrarIconosFlechas(lblmanoGenMatriz);
        jtbIGenes.setModel(new GenesTableModel());
        deshabilitarControles();
        desabilitarNavegacion();
        JSlider[] operadoresSlides = {jsldSeleccion,
                jsldCruce, jsldMutacion};
        final SlideBarGroup operadoresSlideGroup = new SlideBarGroup(operadoresSlides);
        JSlider[] cruceSlides = {jsldBinomial,
                jsldPunto, jsldMultiPunto};
        final SlideBarGroup cruceSlideGroup = new SlideBarGroup(cruceSlides);
        JSlider[] seleccionSlides = {jsldElitista,
                jsldRancking, jsldRuleta};
        final SlideBarGroup seleccionSlideGroup = new SlideBarGroup(seleccionSlides);
        chkBatch.setEnabled(false);
        txtBatch.setEnabled(false);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        mainPanel = new javax.swing.JPanel();
        jToolBar1 = new javax.swing.JToolBar();
        jPanel6 = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jSplitPane3 = new javax.swing.JSplitPane();
        jplMultiCriterio = new javax.swing.JPanel();
        jspMultiCriterio = new javax.swing.JScrollPane();
        jtbMultiCriterio = new javax.swing.JTable();
        jplInfo = new javax.swing.JPanel();
        lblCantCriterios = new javax.swing.JLabel();
        txtCantCriterios = new javax.swing.JTextField();
        jbtGenerarMatriz = new javax.swing.JButton();
        jbtnIncognita = new javax.swing.JToggleButton();
        jbtRandomCompletar = new javax.swing.JButton();
        lblAyudaAHP = new javax.swing.JLabel();
        lblmanoGenMatriz = new javax.swing.JLabel();
        lblmanoIncognita = new javax.swing.JLabel();
        lblmanoRandom = new javax.swing.JLabel();
        jbtnTodoIncognita = new javax.swing.JButton();
        lblmanoTodoIncognita = new javax.swing.JLabel();
        jsplConfAG = new javax.swing.JSplitPane();
        jPanel1 = new javax.swing.JPanel();
        jtbpgraficos = new javax.swing.JTabbedPane();
        jplGraficosApResumen = new javax.swing.JPanel();
        jPanel9 = new javax.swing.JPanel();
        jplgraficosApXGen = new javax.swing.JPanel();
        txtNavegarGen = new javax.swing.JTextField();
        jbtNavegarGenAdelante = new javax.swing.JButton();
        jbtNavegarGenAtras = new javax.swing.JButton();
        jLabel4 = new javax.swing.JLabel();
        jbtNavegarGenUltima = new javax.swing.JButton();
        jbtNavegarGenPrimera = new javax.swing.JButton();
        lblMejoroAptitudDesc = new javax.swing.JLabel();
        lblMejoroAptitud = new javax.swing.JLabel();
        jtbpAdmin = new javax.swing.JTabbedPane();
        jPanel2 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        txtPoblacion = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jlblCortarIteracion = new javax.swing.JLabel();
        jtxtCortarIteracion = new javax.swing.JTextField();
        jtxtCorteEstadistico = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jsldCruce = new javax.swing.JSlider();
        jsldSeleccion = new javax.swing.JSlider();
        jlblOpMutacion = new javax.swing.JLabel();
        jlblOpSeleccion = new javax.swing.JLabel();
        jlblOpCruce = new javax.swing.JLabel();
        jsldMutacion = new javax.swing.JSlider();
        chkGuardarLog = new javax.swing.JCheckBox();
        chkBatch = new javax.swing.JCheckBox();
        txtBatch = new javax.swing.JTextField();
        jplSeleccion = new javax.swing.JPanel();
        jsldRancking = new javax.swing.JSlider();
        jlblRanking = new javax.swing.JLabel();
        jlblRuleta = new javax.swing.JLabel();
        jsldRuleta = new javax.swing.JSlider();
        jlblElitista = new javax.swing.JLabel();
        jsldElitista = new javax.swing.JSlider();
        jplCruce1 = new javax.swing.JPanel();
        jlblMultiPunto = new javax.swing.JLabel();
        jsldMultiPunto = new javax.swing.JSlider();
        jsldPunto = new javax.swing.JSlider();
        jlblPunto = new javax.swing.JLabel();
        jlblBinomial = new javax.swing.JLabel();
        jsldBinomial = new javax.swing.JSlider();
        jScrollPane5 = new javax.swing.JScrollPane();
        jtbMultiPunto = new javax.swing.JTable();
        jplMutacion = new javax.swing.JPanel();
        jlblMetodoMutacion = new javax.swing.JLabel();
        btngSimple = new javax.swing.JRadioButton();
        btngConvergencia = new javax.swing.JRadioButton();
        btngTDec = new javax.swing.JRadioButton();
        btngTCre = new javax.swing.JRadioButton();
        jlblMaxPMutacion = new javax.swing.JLabel();
        jtxtMaxPMutacion = new javax.swing.JTextField();
        jtxtMinPMutacion = new javax.swing.JTextField();
        jlblMinPMutacion = new javax.swing.JLabel();
        jPanel7 = new javax.swing.JPanel();
        jbtCorrer = new javax.swing.JToggleButton();
        jPanel8 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jPanel5 = new javax.swing.JPanel();
        jlblIteracionDesc = new javax.swing.JLabel();
        jlblMejorAptitudDesc = new javax.swing.JLabel();
        jlblConvergenciaDesc = new javax.swing.JLabel();
        jlblCoherenciaDesc = new javax.swing.JLabel();
        jlblCoherencia = new javax.swing.JLabel();
        jlblMejorAptitud = new javax.swing.JLabel();
        jlblConvergencia = new javax.swing.JLabel();
        jlblIteracion = new javax.swing.JLabel();
        jlblIndividuoOptimoDesc = new javax.swing.JLabel();
        jlblIndiciduoOptimo = new javax.swing.JLabel();
        menuBar = new javax.swing.JMenuBar();
        javax.swing.JMenu fileMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
        javax.swing.JMenu helpMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();
        btngMutacion = new javax.swing.ButtonGroup();
        jPanel4 = new javax.swing.JPanel();
        jsclEstructura = new javax.swing.JScrollPane();
        jplEstructura = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        jtbIndividuo = new javax.swing.JTable();
        jScrollPane4 = new javax.swing.JScrollPane();
        jtbIGenes = new javax.swing.JTable();
        chkBuscarEsquema = new javax.swing.JCheckBox();
        lblEstructura = new javax.swing.JLabel();

        mainPanel.setName("mainPanel"); // NOI18N

        jToolBar1.setRollover(true);
        jToolBar1.setName("jToolBar1"); // NOI18N

        jPanel6.setName("jPanel6"); // NOI18N

        jPanel3.setName("jPanel3"); // NOI18N

        jTabbedPane1.setName("jTabbedPane1"); // NOI18N

        jSplitPane3.setName("jSplitPane3"); // NOI18N

        jplMultiCriterio.setName("jplMultiCriterio"); // NOI18N

        jspMultiCriterio.setName("jspMultiCriterio"); // NOI18N

        jtbMultiCriterio.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {"Criterio 1", null, null, null},
                {"Criteiro 2", null, null, null},
                {"Criterio 3", null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "AHP", "Criterio 1", "Criterio 2", "Criterio 3"
            }
        ));
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(agen.AGenApp.class).getContext().getResourceMap(AGenView.class);
        jtbMultiCriterio.setToolTipText(resourceMap.getString("jtbMultiCriterio.toolTipText")); // NOI18N
        jtbMultiCriterio.setCellSelectionEnabled(true);
        jtbMultiCriterio.setName("jtbMultiCriterio"); // NOI18N
        jtbMultiCriterio.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jtbMultiCriterio.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jtbMultiCriterioMouseClicked(evt);
            }
        });
        jspMultiCriterio.setViewportView(jtbMultiCriterio);

        javax.swing.GroupLayout jplMultiCriterioLayout = new javax.swing.GroupLayout(jplMultiCriterio);
        jplMultiCriterio.setLayout(jplMultiCriterioLayout);
        jplMultiCriterioLayout.setHorizontalGroup(
            jplMultiCriterioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jplMultiCriterioLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jspMultiCriterio, javax.swing.GroupLayout.DEFAULT_SIZE, 706, Short.MAX_VALUE)
                .addContainerGap())
        );
        jplMultiCriterioLayout.setVerticalGroup(
            jplMultiCriterioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jplMultiCriterioLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jspMultiCriterio, javax.swing.GroupLayout.DEFAULT_SIZE, 459, Short.MAX_VALUE)
                .addContainerGap())
        );

        jSplitPane3.setRightComponent(jplMultiCriterio);

        jplInfo.setMaximumSize(new java.awt.Dimension(200, 32767));
        jplInfo.setMinimumSize(new java.awt.Dimension(200, 300));
        jplInfo.setName("jplInfo"); // NOI18N
        jplInfo.setPreferredSize(new java.awt.Dimension(200, 300));

        lblCantCriterios.setText(resourceMap.getString("lblCantCriterios.text")); // NOI18N
        lblCantCriterios.setName("lblCantCriterios"); // NOI18N

        txtCantCriterios.setText(resourceMap.getString("txtDim.text")); // NOI18N
        txtCantCriterios.setName("txtDim"); // NOI18N
        txtCantCriterios.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtCantCriteriosKeyPressed(evt);
            }
        });

        jbtGenerarMatriz.setText(resourceMap.getString("jbtGenerarMatriz.text")); // NOI18N
        jbtGenerarMatriz.setName("jbtGenerarMatriz"); // NOI18N
        jbtGenerarMatriz.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtGenerarMatrizActionPerformed(evt);
            }
        });

        jbtnIncognita.setText(resourceMap.getString("jbtnIncognita.text")); // NOI18N
        jbtnIncognita.setFocusable(false);
        jbtnIncognita.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jbtnIncognita.setName("jbtnIncognita"); // NOI18N
        jbtnIncognita.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jbtnIncognita.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnIncognitaActionPerformed(evt);
            }
        });

        jbtRandomCompletar.setText(resourceMap.getString("jbtRandomCompletar.text")); // NOI18N
        jbtRandomCompletar.setFocusable(false);
        jbtRandomCompletar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jbtRandomCompletar.setName("jbtRandomCompletar"); // NOI18N
        jbtRandomCompletar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jbtRandomCompletar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtRandomCompletarActionPerformed(evt);
            }
        });

        lblAyudaAHP.setIcon(resourceMap.getIcon("lblAyudaAHP.icon")); // NOI18N
        lblAyudaAHP.setText(resourceMap.getString("lblAyudaAHP.text")); // NOI18N
        lblAyudaAHP.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        lblAyudaAHP.setName("lblAyudaAHP"); // NOI18N

        lblmanoGenMatriz.setIcon(resourceMap.getIcon("lblmanoGenMatriz.icon")); // NOI18N
        lblmanoGenMatriz.setText(resourceMap.getString("lblmanoGenMatriz.text")); // NOI18N
        lblmanoGenMatriz.setName("lblmanoGenMatriz"); // NOI18N

        lblmanoIncognita.setIcon(resourceMap.getIcon("lblmanoIncognita.icon")); // NOI18N
        lblmanoIncognita.setText(resourceMap.getString("lblmanoIncognita.text")); // NOI18N
        lblmanoIncognita.setName("lblmanoIncognita"); // NOI18N

        lblmanoRandom.setIcon(resourceMap.getIcon("lblmanoRandom.icon")); // NOI18N
        lblmanoRandom.setText(resourceMap.getString("lblmanoRandom.text")); // NOI18N
        lblmanoRandom.setName("lblmanoRandom"); // NOI18N

        jbtnTodoIncognita.setText(resourceMap.getString("jbtnTodoIncognita.text")); // NOI18N
        jbtnTodoIncognita.setName("jbtnTodoIncognita"); // NOI18N
        jbtnTodoIncognita.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnTodoIncognitaActionPerformed(evt);
            }
        });

        lblmanoTodoIncognita.setIcon(resourceMap.getIcon("lblmanoTodoIncognita.icon")); // NOI18N
        lblmanoTodoIncognita.setName("lblmanoTodoIncognita"); // NOI18N

        javax.swing.GroupLayout jplInfoLayout = new javax.swing.GroupLayout(jplInfo);
        jplInfo.setLayout(jplInfoLayout);
        jplInfoLayout.setHorizontalGroup(
            jplInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jplInfoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jplInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jplInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(jbtRandomCompletar, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jbtnIncognita, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addComponent(jbtnTodoIncognita))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jplInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblmanoTodoIncognita)
                    .addComponent(lblmanoRandom)
                    .addComponent(lblmanoIncognita)))
            .addGroup(jplInfoLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lblAyudaAHP))
            .addGroup(jplInfoLayout.createSequentialGroup()
                .addGap(12, 12, 12)
                .addGroup(jplInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(lblCantCriterios)
                    .addGroup(jplInfoLayout.createSequentialGroup()
                        .addComponent(txtCantCriterios, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jbtGenerarMatriz, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblmanoGenMatriz))
        );

        jplInfoLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jbtGenerarMatriz, jbtRandomCompletar, jbtnIncognita, jbtnTodoIncognita});

        jplInfoLayout.setVerticalGroup(
            jplInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jplInfoLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lblCantCriterios)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jplInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jbtGenerarMatriz)
                    .addComponent(lblmanoGenMatriz))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jplInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(lblmanoIncognita)
                    .addComponent(jbtnIncognita))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jplInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(lblmanoRandom)
                    .addComponent(jbtRandomCompletar))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jplInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(lblmanoTodoIncognita)
                    .addComponent(jbtnTodoIncognita))
                .addGap(18, 18, 18)
                .addComponent(lblAyudaAHP, javax.swing.GroupLayout.DEFAULT_SIZE, 278, Short.MAX_VALUE)
                .addContainerGap())
            .addGroup(jplInfoLayout.createSequentialGroup()
                .addGap(36, 36, 36)
                .addComponent(txtCantCriterios, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(379, 379, 379))
        );

        jSplitPane3.setLeftComponent(jplInfo);

        jTabbedPane1.addTab(resourceMap.getString("jSplitPane3.TabConstraints.tabTitle"), jSplitPane3); // NOI18N

        jsplConfAG.setContinuousLayout(true);
        jsplConfAG.setName("jsplConfAG"); // NOI18N

        jPanel1.setName("jPanel1"); // NOI18N

        jtbpgraficos.setName("jtbpgraficos"); // NOI18N

        jplGraficosApResumen.setName("jplGraficosApResumen"); // NOI18N

        javax.swing.GroupLayout jplGraficosApResumenLayout = new javax.swing.GroupLayout(jplGraficosApResumen);
        jplGraficosApResumen.setLayout(jplGraficosApResumenLayout);
        jplGraficosApResumenLayout.setHorizontalGroup(
            jplGraficosApResumenLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 648, Short.MAX_VALUE)
        );
        jplGraficosApResumenLayout.setVerticalGroup(
            jplGraficosApResumenLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 440, Short.MAX_VALUE)
        );

        jtbpgraficos.addTab(resourceMap.getString("jplGraficosApResumen.TabConstraints.tabTitle"), jplGraficosApResumen); // NOI18N

        jPanel9.setName("jPanel9"); // NOI18N

        jplgraficosApXGen.setName("jplgraficosApXGen"); // NOI18N

        javax.swing.GroupLayout jplgraficosApXGenLayout = new javax.swing.GroupLayout(jplgraficosApXGen);
        jplgraficosApXGen.setLayout(jplgraficosApXGenLayout);
        jplgraficosApXGenLayout.setHorizontalGroup(
            jplgraficosApXGenLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 648, Short.MAX_VALUE)
        );
        jplgraficosApXGenLayout.setVerticalGroup(
            jplgraficosApXGenLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 380, Short.MAX_VALUE)
        );

        txtNavegarGen.setText(resourceMap.getString("txtNavegarGen.text")); // NOI18N
        txtNavegarGen.setName("txtNavegarGen"); // NOI18N
        txtNavegarGen.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                txtNavegarGenFocusLost(evt);
            }
        });
        txtNavegarGen.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtNavegarGenKeyPressed(evt);
            }
        });

        jbtNavegarGenAdelante.setIcon(resourceMap.getIcon("jbtNavegarGenAdelante.icon")); // NOI18N
        jbtNavegarGenAdelante.setText(resourceMap.getString("jbtNavegarGenAdelante.text")); // NOI18N
        jbtNavegarGenAdelante.setName("jbtNavegarGenAdelante"); // NOI18N
        jbtNavegarGenAdelante.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtNavegarGenAdelanteActionPerformed(evt);
            }
        });

        jbtNavegarGenAtras.setIcon(resourceMap.getIcon("jbtNavegarGenAtras.icon")); // NOI18N
        jbtNavegarGenAtras.setText(resourceMap.getString("jbtNavegarGenAtras.text")); // NOI18N
        jbtNavegarGenAtras.setName("jbtNavegarGenAtras"); // NOI18N
        jbtNavegarGenAtras.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtNavegarGenAtrasActionPerformed(evt);
            }
        });

        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        jbtNavegarGenUltima.setIcon(resourceMap.getIcon("jbtNavegarGenUltima.icon")); // NOI18N
        jbtNavegarGenUltima.setText(resourceMap.getString("jbtNavegarGenUltima.text")); // NOI18N
        jbtNavegarGenUltima.setName("jbtNavegarGenUltima"); // NOI18N
        jbtNavegarGenUltima.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtNavegarGenUltimaActionPerformed(evt);
            }
        });

        jbtNavegarGenPrimera.setIcon(resourceMap.getIcon("jbtNavegarGenPrimera.icon")); // NOI18N
        jbtNavegarGenPrimera.setText(resourceMap.getString("jbtNavegarGenPrimera.text")); // NOI18N
        jbtNavegarGenPrimera.setName("jbtNavegarGenPrimera"); // NOI18N
        jbtNavegarGenPrimera.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtNavegarGenPrimeraActionPerformed(evt);
            }
        });

        lblMejoroAptitudDesc.setText(resourceMap.getString("lblMejoroAptitudDesc.text")); // NOI18N
        lblMejoroAptitudDesc.setName("lblMejoroAptitudDesc"); // NOI18N

        lblMejoroAptitud.setText(resourceMap.getString("lblMejoroAptitud.text")); // NOI18N
        lblMejoroAptitud.setName("lblMejoroAptitud"); // NOI18N

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jbtNavegarGenPrimera, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jbtNavegarGenAtras, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtNavegarGen, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jbtNavegarGenAdelante, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jbtNavegarGenUltima, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(lblMejoroAptitudDesc)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblMejoroAptitud, javax.swing.GroupLayout.DEFAULT_SIZE, 198, Short.MAX_VALUE)
                .addContainerGap())
            .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jplgraficosApXGen, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(lblMejoroAptitudDesc)
                    .addComponent(jLabel4)
                    .addComponent(lblMejoroAptitud)
                    .addComponent(jbtNavegarGenPrimera, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jbtNavegarGenAtras, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtNavegarGen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jbtNavegarGenAdelante, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jbtNavegarGenUltima, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(401, Short.MAX_VALUE))
            .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
                    .addGap(60, 60, 60)
                    .addComponent(jplgraficosApXGen, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );

        jtbpgraficos.addTab(resourceMap.getString("jPanel9.TabConstraints.tabTitle"), jPanel9); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jtbpgraficos, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 652, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jtbpgraficos, javax.swing.GroupLayout.DEFAULT_SIZE, 471, Short.MAX_VALUE))
        );

        jsplConfAG.setRightComponent(jPanel1);

        jtbpAdmin.setName("jtbpAdmin"); // NOI18N

        jPanel2.setName("jPanel2"); // NOI18N

        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        txtPoblacion.setText(resourceMap.getString("txtPoblacion.text")); // NOI18N
        txtPoblacion.setName("txtPoblacion"); // NOI18N
        txtPoblacion.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                txtPoblacionFocusLost(evt);
            }
        });

        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        jlblCortarIteracion.setText(resourceMap.getString("jlblCortarIteracion.text")); // NOI18N
        jlblCortarIteracion.setName("jlblCortarIteracion"); // NOI18N

        jtxtCortarIteracion.setText(resourceMap.getString("jtxtCortarIteracion.text")); // NOI18N
        jtxtCortarIteracion.setName("jtxtCortarIteracion"); // NOI18N
        jtxtCortarIteracion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtxtCortarIteracionActionPerformed(evt);
            }
        });
        jtxtCortarIteracion.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                jtxtCortarIteracionFocusLost(evt);
            }
        });

        jtxtCorteEstadistico.setText(resourceMap.getString("jtxtCorteEstadistico.text")); // NOI18N
        jtxtCorteEstadistico.setName("jtxtCorteEstadistico"); // NOI18N
        jtxtCorteEstadistico.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                jtxtCorteEstadisticoFocusLost(evt);
            }
        });

        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        jsldCruce.setPaintLabels(true);
        jsldCruce.setPaintTicks(true);
        jsldCruce.setSnapToTicks(true);
        jsldCruce.setName("jsldCruce"); // NOI18N

        jsldSeleccion.setFont(new java.awt.Font("Arial", 0, 11));
        jsldSeleccion.setPaintLabels(true);
        jsldSeleccion.setPaintTicks(true);
        jsldSeleccion.setSnapToTicks(true);
        jsldSeleccion.setName("jsldSeleccion"); // NOI18N

        jlblOpMutacion.setText(resourceMap.getString("jlblOpMutacion.text")); // NOI18N
        jlblOpMutacion.setName("jlblOpMutacion"); // NOI18N

        jlblOpSeleccion.setText(resourceMap.getString("jlblOpSeleccion.text")); // NOI18N
        jlblOpSeleccion.setName("jlblOpSeleccion"); // NOI18N

        jlblOpCruce.setText(resourceMap.getString("jlblOpCruce.text")); // NOI18N
        jlblOpCruce.setName("jlblOpCruce"); // NOI18N

        jsldMutacion.setPaintLabels(true);
        jsldMutacion.setPaintTicks(true);
        jsldMutacion.setSnapToTicks(true);
        jsldMutacion.setName("jsldMutacion"); // NOI18N

        chkGuardarLog.setText(resourceMap.getString("chkGuardarLog.text")); // NOI18N
        chkGuardarLog.setName("chkGuardarLog"); // NOI18N
        chkGuardarLog.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkGuardarLogActionPerformed(evt);
            }
        });

        chkBatch.setText(resourceMap.getString("chkBatch.text")); // NOI18N
        chkBatch.setName("chkBatch"); // NOI18N
        chkBatch.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkBatchActionPerformed(evt);
            }
        });

        txtBatch.setText(resourceMap.getString("txtBatch.text")); // NOI18N
        txtBatch.setName("txtBatch"); // NOI18N
        txtBatch.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                txtBatchFocusLost(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jsldCruce, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jsldSeleccion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jlblOpMutacion)
                    .addComponent(jlblOpSeleccion)
                    .addComponent(jlblOpCruce)
                    .addComponent(jsldMutacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(txtPoblacion, javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jtxtCorteEstadistico, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel3))
                    .addComponent(chkGuardarLog)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                            .addComponent(chkBatch)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(txtBatch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                            .addComponent(jlblCortarIteracion)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtxtCortarIteracion, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(22, Short.MAX_VALUE))
        );

        jPanel2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jsldCruce, jsldMutacion, jsldSeleccion});

        jPanel2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jtxtCortarIteracion, txtBatch});

        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jlblOpSeleccion)
                .addComponent(jsldSeleccion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(11, 11, 11)
                .addComponent(jlblOpCruce)
                .addComponent(jsldCruce, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jlblOpMutacion)
                .addComponent(jsldMutacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtPoblacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtxtCorteEstadistico, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jlblCortarIteracion)
                    .addComponent(jtxtCortarIteracion))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(chkGuardarLog)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(chkBatch)
                    .addComponent(txtBatch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(33, 33, 33))
        );

        jPanel2Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jsldCruce, jsldMutacion, jsldSeleccion});

        jtbpAdmin.addTab(resourceMap.getString("jPanel2.TabConstraints.tabTitle"), jPanel2); // NOI18N

        jplSeleccion.setName("jplSeleccion"); // NOI18N
        jplSeleccion.setPreferredSize(new java.awt.Dimension(250, 412));

        jsldRancking.setName("jsldRancking"); // NOI18N

        jlblRanking.setText(resourceMap.getString("jlblRanking.text")); // NOI18N
        jlblRanking.setName("jlblRanking"); // NOI18N

        jlblRuleta.setText(resourceMap.getString("jlblRuleta.text")); // NOI18N
        jlblRuleta.setName("jlblRuleta"); // NOI18N

        jsldRuleta.setName("jsldRuleta"); // NOI18N

        jlblElitista.setText(resourceMap.getString("jlblElitista.text")); // NOI18N
        jlblElitista.setName("jlblElitista"); // NOI18N

        jsldElitista.setName("jsldElitista"); // NOI18N

        javax.swing.GroupLayout jplSeleccionLayout = new javax.swing.GroupLayout(jplSeleccion);
        jplSeleccion.setLayout(jplSeleccionLayout);
        jplSeleccionLayout.setHorizontalGroup(
            jplSeleccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jplSeleccionLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jplSeleccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jlblElitista)
                    .addComponent(jlblRanking)
                    .addGroup(jplSeleccionLayout.createSequentialGroup()
                        .addComponent(jlblRuleta)
                        .addGap(157, 157, 157))
                    .addComponent(jsldRancking, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jsldElitista, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jsldRuleta, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(62, Short.MAX_VALUE))
        );
        jplSeleccionLayout.setVerticalGroup(
            jplSeleccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jplSeleccionLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jlblElitista)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jsldElitista, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(1, 1, 1)
                .addComponent(jlblRanking)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jsldRancking, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jlblRuleta)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jsldRuleta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(250, Short.MAX_VALUE))
        );

        jplSeleccionLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jsldElitista, jsldRancking, jsldRuleta});

        jtbpAdmin.addTab(resourceMap.getString("jplSeleccion.TabConstraints.tabTitle"), jplSeleccion); // NOI18N

        jplCruce1.setName("jplCruce1"); // NOI18N

        jlblMultiPunto.setText(resourceMap.getString("jlblMultiPunto.text")); // NOI18N
        jlblMultiPunto.setName("jlblMultiPunto"); // NOI18N

        jsldMultiPunto.setName("jsldMultiPunto"); // NOI18N

        jsldPunto.setName("jsldPunto"); // NOI18N

        jlblPunto.setText(resourceMap.getString("jlblPunto.text")); // NOI18N
        jlblPunto.setName("jlblPunto"); // NOI18N

        jlblBinomial.setText(resourceMap.getString("jlblBinomial.text")); // NOI18N
        jlblBinomial.setName("jlblBinomial"); // NOI18N

        jsldBinomial.setName("jsldBinomial"); // NOI18N

        jScrollPane5.setName("jScrollPane5"); // NOI18N

        jtbMultiPunto.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {"Aij"},
                {"Aij"},
                {"Aij"},
                {"Aij"}
            },
            new String [] {
                "Puntos de cruce"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jtbMultiPunto.setToolTipText(resourceMap.getString("jtbMultiPunto.toolTipText")); // NOI18N
        jtbMultiPunto.setCellSelectionEnabled(true);
        jtbMultiPunto.setName("jtbMultiPunto"); // NOI18N
        jtbMultiPunto.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jtbMultiPunto.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jtbMultiPuntoKeyPressed(evt);
            }
        });
        jScrollPane5.setViewportView(jtbMultiPunto);
        jtbMultiPunto.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_INTERVAL_SELECTION);
        jtbMultiPunto.getColumnModel().getColumn(0).setHeaderValue(resourceMap.getString("jtbMultiPunto.columnModel.title0")); // NOI18N

        javax.swing.GroupLayout jplCruce1Layout = new javax.swing.GroupLayout(jplCruce1);
        jplCruce1.setLayout(jplCruce1Layout);
        jplCruce1Layout.setHorizontalGroup(
            jplCruce1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jplCruce1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jplCruce1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jsldBinomial, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jlblBinomial)
                    .addComponent(jsldPunto, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jlblPunto)
                    .addComponent(jsldMultiPunto, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jlblMultiPunto)
                    .addComponent(jScrollPane5, 0, 0, Short.MAX_VALUE))
                .addContainerGap(62, Short.MAX_VALUE))
        );

        jplCruce1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jsldBinomial, jsldMultiPunto, jsldPunto});

        jplCruce1Layout.setVerticalGroup(
            jplCruce1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jplCruce1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jlblBinomial)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jsldBinomial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jlblPunto)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jsldPunto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jlblMultiPunto)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jsldMultiPunto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(110, Short.MAX_VALUE))
        );

        jplCruce1Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jsldMultiPunto, jsldPunto});

        jtbpAdmin.addTab(resourceMap.getString("jplCruce1.TabConstraints.tabTitle"), jplCruce1); // NOI18N

        jplMutacion.setName("jplMutacion"); // NOI18N

        jlblMetodoMutacion.setText(resourceMap.getString("jlblMetodoMutacion.text")); // NOI18N
        jlblMetodoMutacion.setName("jlblMetodoMutacion"); // NOI18N

        btngSimple.setText(resourceMap.getString("btngSimple.text")); // NOI18N
        btngSimple.setName("btngSimple"); // NOI18N
        btngSimple.setSelected(true);
        btngSimple.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btngSimpleActionPerformed(evt);
            }
        });

        btngConvergencia.setText(resourceMap.getString("btngConvergencia.text")); // NOI18N
        btngConvergencia.setName("btngConvergencia"); // NOI18N
        btngConvergencia.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btngConvergenciaActionPerformed(evt);
            }
        });

        btngTDec.setText(resourceMap.getString("btngTDec.text")); // NOI18N
        btngTDec.setName("btngTDec"); // NOI18N
        btngTDec.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btngTDecActionPerformed(evt);
            }
        });

        btngTCre.setText(resourceMap.getString("btngTCre.text")); // NOI18N
        btngTCre.setName("btngTCre"); // NOI18N
        btngTCre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btngTCreActionPerformed(evt);
            }
        });

        jlblMaxPMutacion.setText(resourceMap.getString("jlblMaxPMutacion.text")); // NOI18N
        jlblMaxPMutacion.setName("jlblMaxPMutacion"); // NOI18N

        jtxtMaxPMutacion.setText(resourceMap.getString("jtxtMaxPMutacion.text")); // NOI18N
        jtxtMaxPMutacion.setName("jtxtMaxPMutacion"); // NOI18N

        jtxtMinPMutacion.setText(resourceMap.getString("jtxtMinPMutacion.text")); // NOI18N
        jtxtMinPMutacion.setName("jtxtMinPMutacion"); // NOI18N

        jlblMinPMutacion.setText(resourceMap.getString("jlblMinPMutacion.text")); // NOI18N
        jlblMinPMutacion.setName("jlblMinPMutacion"); // NOI18N

        javax.swing.GroupLayout jplMutacionLayout = new javax.swing.GroupLayout(jplMutacion);
        jplMutacion.setLayout(jplMutacionLayout);
        jplMutacionLayout.setHorizontalGroup(
            jplMutacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 274, Short.MAX_VALUE)
            .addGroup(jplMutacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jplMutacionLayout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jplMutacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jlblMetodoMutacion)
                        .addComponent(btngSimple)
                        .addComponent(btngConvergencia)
                        .addComponent(btngTDec)
                        .addComponent(btngTCre)
                        .addComponent(jlblMaxPMutacion)
                        .addGroup(jplMutacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jplMutacionLayout.createSequentialGroup()
                                .addGap(12, 12, 12)
                                .addComponent(jtxtMaxPMutacion))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jplMutacionLayout.createSequentialGroup()
                                .addGap(12, 12, 12)
                                .addComponent(jtxtMinPMutacion))
                            .addComponent(jlblMinPMutacion, javax.swing.GroupLayout.Alignment.LEADING)))
                    .addContainerGap()))
        );
        jplMutacionLayout.setVerticalGroup(
            jplMutacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 452, Short.MAX_VALUE)
            .addGroup(jplMutacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jplMutacionLayout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jlblMetodoMutacion)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(btngSimple)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(btngConvergencia)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(btngTDec)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(btngTCre)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jlblMaxPMutacion)
                    .addGap(2, 2, 2)
                    .addComponent(jtxtMaxPMutacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jlblMinPMutacion)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jtxtMinPMutacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(203, Short.MAX_VALUE)))
        );

        jtbpAdmin.addTab(resourceMap.getString("jplMutacion.TabConstraints.tabTitle"), jplMutacion); // NOI18N

        jsplConfAG.setLeftComponent(jtbpAdmin);

        jTabbedPane1.addTab(resourceMap.getString("jsplConfAG.TabConstraints.tabTitle"), jsplConfAG); // NOI18N

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 940, Short.MAX_VALUE)
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 514, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(20, Short.MAX_VALUE))
        );

        jPanel7.setName("jPanel7"); // NOI18N

        jbtCorrer.setText(resourceMap.getString("jtogbutCorrer.text")); // NOI18N
        jbtCorrer.setToolTipText(resourceMap.getString("jtogbutCorrer.toolTipText")); // NOI18N
        jbtCorrer.setName("jtogbutCorrer"); // NOI18N
        jbtCorrer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtCorrerActionPerformed(evt);
            }
        });

        jPanel8.setName("jPanel8"); // NOI18N

        jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
        jScrollPane1.setName("jScrollPane1"); // NOI18N

        jPanel5.setName("jPanel5"); // NOI18N

        jlblIteracionDesc.setText(resourceMap.getString("jlblIteracionDesc.text")); // NOI18N
        jlblIteracionDesc.setToolTipText(resourceMap.getString("jlblIteracionDesc.toolTipText")); // NOI18N
        jlblIteracionDesc.setName("jlblIteracionDesc"); // NOI18N

        jlblMejorAptitudDesc.setText(resourceMap.getString("jlblMejorAptitudDesc.text")); // NOI18N
        jlblMejorAptitudDesc.setToolTipText(resourceMap.getString("jlblMejorAptitudDesc.toolTipText")); // NOI18N
        jlblMejorAptitudDesc.setName("jlblMejorAptitudDesc"); // NOI18N

        jlblConvergenciaDesc.setText(resourceMap.getString("jlblConvergenciaDesc.text")); // NOI18N
        jlblConvergenciaDesc.setToolTipText(resourceMap.getString("jlblConvergenciaDesc.toolTipText")); // NOI18N
        jlblConvergenciaDesc.setName("jlblConvergenciaDesc"); // NOI18N

        jlblCoherenciaDesc.setText(resourceMap.getString("jlblCoherenciaDesc.text")); // NOI18N
        jlblCoherenciaDesc.setToolTipText(resourceMap.getString("jlblCoherenciaDesc.toolTipText")); // NOI18N
        jlblCoherenciaDesc.setName("jlblCoherenciaDesc"); // NOI18N

        jlblCoherencia.setText(resourceMap.getString("jlblCoherencia.text")); // NOI18N
        jlblCoherencia.setName("jlblCoherencia"); // NOI18N

        jlblMejorAptitud.setText(resourceMap.getString("jlblMejorAptitud.text")); // NOI18N
        jlblMejorAptitud.setName("jlblMejorAptitud"); // NOI18N

        jlblConvergencia.setText(resourceMap.getString("jlblConvergencia.text")); // NOI18N
        jlblConvergencia.setName("jlblConvergencia"); // NOI18N

        jlblIteracion.setText(resourceMap.getString("jlblIteracion.text")); // NOI18N
        jlblIteracion.setName("jlblIteracion"); // NOI18N

        jlblIndividuoOptimoDesc.setText(resourceMap.getString("jlblIndividuoOptimoDesc.text")); // NOI18N
        jlblIndividuoOptimoDesc.setToolTipText(resourceMap.getString("jlblIndividuoOptimoDesc.toolTipText")); // NOI18N
        jlblIndividuoOptimoDesc.setName("jlblIndividuoOptimoDesc"); // NOI18N

        jlblIndiciduoOptimo.setText(resourceMap.getString("jlblIndiciduoOptimo.text")); // NOI18N
        jlblIndiciduoOptimo.setName("jlblIndiciduoOptimo"); // NOI18N

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jlblMejorAptitudDesc)
                    .addComponent(jlblConvergenciaDesc)
                    .addComponent(jlblIndividuoOptimoDesc)
                    .addComponent(jlblIteracionDesc)
                    .addComponent(jlblCoherenciaDesc))
                .addGap(574, 574, 574)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jlblMejorAptitud, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jlblConvergencia, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jlblIndiciduoOptimo, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jlblIteracion, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jlblCoherencia, javax.swing.GroupLayout.Alignment.TRAILING))
                .addContainerGap(93, Short.MAX_VALUE))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addComponent(jlblIteracionDesc)
                        .addGap(6, 6, 6)
                        .addComponent(jlblCoherenciaDesc)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jlblMejorAptitudDesc)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jlblConvergenciaDesc)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jlblIndividuoOptimoDesc))
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addComponent(jlblIteracion)
                        .addGap(6, 6, 6)
                        .addComponent(jlblCoherencia)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jlblMejorAptitud)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jlblConvergencia)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jlblIndiciduoOptimo)))
                .addContainerGap(33, Short.MAX_VALUE))
        );

        jScrollPane1.setViewportView(jPanel5);

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 876, Short.MAX_VALUE)
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 129, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jbtCorrer))
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jbtCorrer)))
                .addContainerGap())
        );

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
        mainPanel.setLayout(mainPanelLayout);
        mainPanelLayout.setHorizontalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 976, Short.MAX_VALUE)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addGap(12, 12, 12)
                .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        mainPanelLayout.setVerticalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        menuBar.setName("menuBar"); // NOI18N

        fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
        fileMenu.setName("fileMenu"); // NOI18N

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(agen.AGenApp.class).getContext().getActionMap(AGenView.class, this);
        exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
        exitMenuItem.setName("exitMenuItem"); // NOI18N
        fileMenu.add(exitMenuItem);

        menuBar.add(fileMenu);

        helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N
        helpMenu.setName("helpMenu"); // NOI18N

        aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N
        aboutMenuItem.setName("aboutMenuItem"); // NOI18N
        helpMenu.add(aboutMenuItem);

        menuBar.add(helpMenu);

        btngMutacion.add(btngConvergencia);
        btngMutacion.add(btngSimple);
        btngMutacion.add(btngTCre);
        btngMutacion.add(btngTDec);

        jPanel4.setName("jPanel4"); // NOI18N

        jsclEstructura.setHorizontalScrollBar(null);
        jsclEstructura.setMaximumSize(new java.awt.Dimension(100, 800));
        jsclEstructura.setMinimumSize(new java.awt.Dimension(100, 200));
        jsclEstructura.setName("jspIndividuo"); // NOI18N
        jsclEstructura.setVisible(false);

        jplEstructura.setToolTipText(resourceMap.getString("jplEstructura.toolTipText")); // NOI18N
        jplEstructura.setName("jplEstructura"); // NOI18N

        jScrollPane3.setName("jScrollPane3"); // NOI18N

        jtbIndividuo.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {"Aij"},
                {"Aij"},
                {"Aij"},
                {"Aij"}
            },
            new String [] {
                "Individuo"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jtbIndividuo.setToolTipText(resourceMap.getString("jtbIndividuo.toolTipText")); // NOI18N
        jtbIndividuo.setCellSelectionEnabled(true);
        jtbIndividuo.setName("jtbIndividuo"); // NOI18N
        jtbIndividuo.setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
        jtbIndividuo.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jtbIndividuoKeyPressed(evt);
            }
        });
        jScrollPane3.setViewportView(jtbIndividuo);

        jScrollPane4.setName("jScrollPane4"); // NOI18N

        jtbIGenes.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {"Aij;Aij;Aij"},
                {"Aij;Aij"},
                {"Otros"}
            },
            new String [] {
                "Genes"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jtbIGenes.setToolTipText(resourceMap.getString("jtbIGenes.toolTipText")); // NOI18N
        jtbIGenes.setCellSelectionEnabled(true);
        jtbIGenes.setName("jtbIGenes"); // NOI18N
        jtbIGenes.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jtbIGenesKeyPressed(evt);
            }
        });
        jScrollPane4.setViewportView(jtbIGenes);

        javax.swing.GroupLayout jplEstructuraLayout = new javax.swing.GroupLayout(jplEstructura);
        jplEstructura.setLayout(jplEstructuraLayout);
        jplEstructuraLayout.setHorizontalGroup(
            jplEstructuraLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jplEstructuraLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(287, Short.MAX_VALUE))
        );
        jplEstructuraLayout.setVerticalGroup(
            jplEstructuraLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jplEstructuraLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jplEstructuraLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 329, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 329, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(1820, Short.MAX_VALUE))
        );

        jsclEstructura.setViewportView(jplEstructura);

        chkBuscarEsquema.setText(resourceMap.getString("chkBuscarEsquema.text")); // NOI18N
        chkBuscarEsquema.setToolTipText(resourceMap.getString("chkBuscarEsquema.toolTipText")); // NOI18N
        chkBuscarEsquema.setName("chkBuscarEsquema"); // NOI18N
        chkBuscarEsquema.setVisible(false);
        chkBuscarEsquema.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                chkBuscarEsquemaStateChanged(evt);
            }
        });

        lblEstructura.setText(resourceMap.getString("lblEstructura.text")); // NOI18N
        lblEstructura.setName("lblEstructura"); // NOI18N
        lblEstructura.setVisible(false);

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 215, Short.MAX_VALUE)
            .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel4Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jsclEstructura, javax.swing.GroupLayout.PREFERRED_SIZE, 191, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(jPanel4Layout.createSequentialGroup()
                            .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(chkBuscarEsquema)
                                .addComponent(lblEstructura))
                            .addGap(35, 35, 35)))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 364, Short.MAX_VALUE)
            .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel4Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(chkBuscarEsquema)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(lblEstructura)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jsclEstructura, javax.swing.GroupLayout.PREFERRED_SIZE, 289, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );

        setComponent(mainPanel);
        setMenuBar(menuBar);
    }// </editor-fold>//GEN-END:initComponents
/**
 * Determina si hay que permitir que el usuario especifíque esquemas por su
 * cuenta, o si el sistema deberia tratar de identificarlos para cada corrida.
 * No implementado.
 * @param evt
 */

    public JToggleButton getJbtCorrer() {
        return jbtCorrer;
    }
public JPanel getpanelgragicos(){
    return jplGraficosApResumen;
}
    private void chkBuscarEsquemaStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_chkBuscarEsquemaStateChanged
        jtbIGenes.setEnabled(!chkBuscarEsquema.isSelected());
        jtbIndividuo.setEnabled(!chkBuscarEsquema.isSelected());
}//GEN-LAST:event_chkBuscarEsquemaStateChanged

    private void jbtCorrerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtCorrerActionPerformed
    correrAction();
}//GEN-LAST:event_jbtCorrerActionPerformed
protected void correrAction(){
    //        int n = 3000;
//        System.out.println("Tardo en generar una matriz cuadrada de orden "
//                + n + ": " + Aptitud.pruebaAutovalor(n)
//                + " milisegundos");
//        return;
        /*agregar cuando tenga los eltos, un trigger para poner en Genes uno
        para cada elemento por defecto al iniciar la corrida, Si el usuario no
        cambio manualmente.*/
        //AGenApp app = AGenApp.getApplication();
        if (jbtCorrer.isSelected()) {
            if (!checkearIncognitas()){
                String texto = "<html>No marcó incognitas. Utilice el botón \"Incognita\".<br>";
                texto += "Una vez seleccionadas las incognitas en la tabla AHP<br>";
                texto += "desmarque el botón \"Incognita\" volviendo a hacer click.<br></html>";
                agen.dialogs.Aviso aviso = new agen.dialogs.Aviso(this.getFrame()
                        , true,texto,"No marcó las incognitas" );
                aviso.setVisible(true);
                jbtCorrer.setSelected(false);

            } else {
                lblAyudaAHP.setText(AyudaContextual.PASO5_PAUSA);
                jbtCorrer.setText("Pausa");
                deshabilitarControles();
                desabilitarNavegacion();
                jbtGenerarMatriz.setEnabled(false);
                txtCantCriterios.setEnabled(false);
                jbtCorrer.setEnabled(true);
                /*las celdas que se hallan dejado vacias, completarlas.*/
                completarAHPConAleatorios();
                AGenApp.pause = false;
                controlarMultiPunto();
                AGenApp.correr(((AHPTableModel)jtbMultiCriterio.getModel())
                        .getMatrizParaCalculo(),eltosIndivPos, jsldSeleccion.getValue(),
                        jsldCruce.getValue(), jsldMutacion.getValue()
                        ,jsldElitista.getValue(),jsldRancking.getValue(),jsldRuleta.getValue(),
                        jsldBinomial.getValue(),jsldPunto.getValue(),jsldMultiPunto.getValue(),
                        multiPunto, metodoMutacion,
                        Double.parseDouble(jtxtMaxPMutacion.getText())
                        , Double.parseDouble(jtxtMinPMutacion.getText()),
                        chkGuardarLog.isSelected(),chkBatch.isSelected(),
                        Integer.parseInt(txtBatch.getText()));
            }
        } else {
//            if (AGenApp.corriendo){
//                abilitarNavegacion();
//            } else {
//                desabilitarNavegacion();
//            }
             abilitarNavegacion();
            lblAyudaAHP.setText(AyudaContextual.PASO6_CORRER);
            jbtCorrer.setText("Correr");
            jbtGenerarMatriz.setEnabled(true);
            txtCantCriterios.setEnabled(true);
            AGenApp.pause = true;
        }
}
    private boolean renovarMatriz() {
        lblAyudaAHP.setText(AyudaContextual.PASO2_INCOGNITAS);
        eltosIndivPos = new int[0][2];
        mostrarIconosFlechas(lblmanoIncognita);
        try {
            int cant = Integer.parseInt(txtCantCriterios.getText());
            if (cant < 11 && cant > 1 ) {
                AHPTableModel tablemodel = new AHPTableModel();
                tablemodel.setMatriz(new String[Integer.parseInt(txtCantCriterios.getText())][Integer.parseInt(txtCantCriterios.getText()) + 1]);
                jtbMultiCriterio.setModel(tablemodel);
                matrizDefinida = true;
                abilitarControles();
                return true;
            }

        } catch (Exception e) {
            System.out.println("AGenView.renovarMatriz: " + e.getMessage());
        }
        return false;
    }
    /**
     * Con el valor obtenido de txtCantCriterios se genera la matriz Multi
     * Criterio
     * @param evt
     */
    private void jbtGenerarMatrizActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtGenerarMatrizActionPerformed
         renovarMatriz();

}//GEN-LAST:event_jbtGenerarMatrizActionPerformed
    /**
     * Escuchando si el usuario preciona enter en vez de hacer click en el boton
     * GenerarMatriz, al editar el txtCantCriterios
     * @param evt
     */
    private void txtCantCriteriosKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtCantCriteriosKeyPressed

        if (evt.getKeyCode() == java.awt.event.KeyEvent.VK_ENTER) {
            renovarMatriz();
        }
    }//GEN-LAST:event_txtCantCriteriosKeyPressed

    /**
     * Al presionar Enter habiendo seleccionado eltos en la tabla del individuo
     * se asocian esos eltos como un gen en el cruce.
     * No implementado.
     * @param evt
     */
    private void jtbIndividuoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jtbIndividuoKeyPressed
        if (evt.getKeyCode() == java.awt.event.KeyEvent.VK_ENTER) {
            agregarGen(jtbIndividuo.getSelectedRows());
        }
    }//GEN-LAST:event_jtbIndividuoKeyPressed
    /**
     * Al presionar Enter habiendo seleccionado eltos en la tabla del Gen
     * se liberan los eltos asociados al Gen elegido para ser usados
     * independientemente.
     * No implementado.
     * @param evt
     */
    private void jtbIGenesKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jtbIGenesKeyPressed
        if (evt.getKeyCode() == java.awt.event.KeyEvent.VK_ENTER) {
            borrarGen(jtbIGenes.getSelectedRow());
        }
    }//GEN-LAST:event_jtbIGenesKeyPressed
    /**
     * Cambio el cursor para indicar que elusuario puede elegir celdas para las que
     * no conoce las prioridades.
     * @param evt
     */
    private void jbtnIncognitaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnIncognitaActionPerformed

        if (jbtnIncognita.isSelected()) {
            Cursor incognitaCursor = new Cursor(Cursor.HAND_CURSOR);
            this.getComponent().setCursor(incognitaCursor);
            deshabilitarControles();
            jbtnIncognita.setEnabled(true);
            jbtnTodoIncognita.setEnabled(true);
            jtbMultiCriterio.setEnabled(true);
        } else {
            if (checkearCeldasVacias()){
                lblAyudaAHP.setText(AyudaContextual.PASO3_COMPLETAR);
                mostrarIconosFlechas(lblmanoRandom);
            } else {
                lblAyudaAHP.setText(AyudaContextual.PASO4_CONFIGURACION);
                mostrarIconosFlechas(new JLabel());
            }
            Cursor incognitaCursor = Cursor.getDefaultCursor();
            this.getComponent().setCursor(incognitaCursor);
            /*supongo que al volver al cursor normal ya puedo inferir la
            estructura del individuo*/
            abilitarControles();
            generarIndividuo();
        }
    }//GEN-LAST:event_jbtnIncognitaActionPerformed

    /**
     * Si el cursos indica seleccion de incognitas responder al click marcando
     * la celda como tal.
     * @param evt
     */
    private void jtbMultiCriterioMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jtbMultiCriterioMouseClicked
        // TODO add your handling code here:
        int selRow = jtbMultiCriterio.getSelectedRow();
        int selCol = jtbMultiCriterio.getSelectedColumn();
        if (this.getComponent().getCursor().getType() == Cursor.HAND_CURSOR &&
                selCol > 0 && selRow + 1 != selCol) {
            jtbMultiCriterio.getModel().setValueAt("¿?", selRow, selCol);
        }
    }//GEN-LAST:event_jtbMultiCriterioMouseClicked

    /**
     * Cuando se oprime eljtoggleButton jbtRandomCompletar hay que verificar las
     * celdas con valor "" y asignarles valores validos aleatorios.
     * @param evt
     */
    private void jbtRandomCompletarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtRandomCompletarActionPerformed
        if (!checkearIncognitas()){
            lblAyudaAHP.setText(AyudaContextual.PASO2_INCOGNITAS);
            mostrarIconosFlechas(lblmanoIncognita);
        }else{
            lblAyudaAHP.setText(AyudaContextual.PASO4_CONFIGURACION);
            mostrarIconosFlechas(new JLabel());
        }
        completarAHPConAleatorios();
    }//GEN-LAST:event_jbtRandomCompletarActionPerformed
    /**
     * Iniciar manuealmente el calculo de la coherencia de la matriz, en duda
     * su usabilidad / utilidad.
     * @param evt
     */
    private void jtbMultiPuntoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jtbMultiPuntoKeyPressed
        // TODO add your handling code here:
        if (evt.getKeyCode() == java.awt.event.KeyEvent.VK_ENTER) {
            agregarPunto(jtbMultiPunto.getSelectedRows());
        }
}//GEN-LAST:event_jtbMultiPuntoKeyPressed

    private void btngSimpleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btngSimpleActionPerformed

        setMetodoMutacion((javax.swing.JRadioButton)evt.getSource());
    }//GEN-LAST:event_btngSimpleActionPerformed

    private void btngConvergenciaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btngConvergenciaActionPerformed

        setMetodoMutacion((javax.swing.JRadioButton)evt.getSource());
    }//GEN-LAST:event_btngConvergenciaActionPerformed

    private void btngTDecActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btngTDecActionPerformed

        setMetodoMutacion((javax.swing.JRadioButton)evt.getSource());
    }//GEN-LAST:event_btngTDecActionPerformed

    private void btngTCreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btngTCreActionPerformed
        setMetodoMutacion((javax.swing.JRadioButton)evt.getSource());
    }//GEN-LAST:event_btngTCreActionPerformed

    private void jtxtCortarIteracionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtxtCortarIteracionActionPerformed
        // TODO add your handling code here:
      


}//GEN-LAST:event_jtxtCortarIteracionActionPerformed

    private void jtxtCortarIteracionFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jtxtCortarIteracionFocusLost
        // TODO add your handling code here:
        try {
            int cortarEnIteracion = Integer.parseInt(jtxtCortarIteracion.getText());
            AGenApp.cortarEnIteracion = cortarEnIteracion;
        } catch (Exception e) {
            System.err.println(e.getMessage());
        }
    }//GEN-LAST:event_jtxtCortarIteracionFocusLost

    private void txtPoblacionFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtPoblacionFocusLost
        try {
            int pblacionInicial = Integer.parseInt(txtPoblacion.getText());
            AGenApp.poblacionInicial = pblacionInicial;
        } catch (Exception e) {
            System.err.println(e.getMessage());
        }
}//GEN-LAST:event_txtPoblacionFocusLost

    private void jtxtCorteEstadisticoFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jtxtCorteEstadisticoFocusLost
        // TODO add your handling code here:
         try {
            int corteEstadistico = Integer.parseInt(jtxtCorteEstadistico.getText());
            Optimo.generacionesCorteOptimo = corteEstadistico;
        } catch (Exception e) {
            System.err.println(e.getMessage());
        }
    }//GEN-LAST:event_jtxtCorteEstadisticoFocusLost

    private void jbtnTodoIncognitaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnTodoIncognitaActionPerformed
        // TODO add your handling code here:

        AHPTableModel model = (AHPTableModel) jtbMultiCriterio.getModel();
        for (int i = 0; i < model.getRowCount(); i++) {
            for (int j = i + 2; j < model.getColumnCount(); j++) {
                if (model.getValueAt(i, j).equals("")) {
                    /*Completo los vacios con Aleatorios. Util cuando se desea
                    especificar las incognitas sin lenar el resto de las celdas*/
                    model.setValueAt("¿?",i,j);
                }
            }
        }
        generarIndividuo();
    }//GEN-LAST:event_jbtnTodoIncognitaActionPerformed

    private void txtNavegarGenKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtNavegarGenKeyPressed
        // TODO add your handling code here:
        if (evt.getKeyChar() == KeyEvent.VK_ENTER) {
            try {
                int generacion = Integer.parseInt(txtNavegarGen.getText());
                if (generacion >= 0 && generacion < AGenApp.getCorrerThead().
                        getIteracion() - Optimo.generacionesCorteOptimo) {
                    AGenApp.actualizarGraficoAptitudesXGen(generacion);
                }
            } catch (Exception e) {
                txtNavegarGen.setText("0");
                AGenApp.actualizarGraficoAptitudesXGen(0);
            }
        }
    }//GEN-LAST:event_txtNavegarGenKeyPressed

    private void jbtNavegarGenAdelanteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtNavegarGenAdelanteActionPerformed
        // TODO add your handling code here:
        int generacion = Integer.parseInt(txtNavegarGen.getText());
        if (generacion <
                AGenApp.getCorrerThead().getIteracion()
                - Optimo.generacionesCorteOptimo){
            txtNavegarGen.setText(String.valueOf(++generacion));
            AGenApp.actualizarGraficoAptitudesXGen(generacion);

        }
    }//GEN-LAST:event_jbtNavegarGenAdelanteActionPerformed

    private void jbtNavegarGenAtrasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtNavegarGenAtrasActionPerformed
        int generacion = Integer.parseInt(txtNavegarGen.getText());
        if (generacion > 0){
            txtNavegarGen.setText(String.valueOf(--generacion));
            AGenApp.actualizarGraficoAptitudesXGen(generacion);
        }
    }//GEN-LAST:event_jbtNavegarGenAtrasActionPerformed

    private void jbtNavegarGenPrimeraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtNavegarGenPrimeraActionPerformed
        // TODO add your handling code here:
        txtNavegarGen.setText(String.valueOf(0));
        AGenApp.actualizarGraficoAptitudesXGen(0);
    }//GEN-LAST:event_jbtNavegarGenPrimeraActionPerformed

    private void jbtNavegarGenUltimaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtNavegarGenUltimaActionPerformed
        // TODO add your handling code here:
        int generacion = AGenApp.getCorrerThead().getIteracion() -
                Optimo.generacionesCorteOptimo;
        txtNavegarGen.setText(String.valueOf(generacion));
        AGenApp.actualizarGraficoAptitudesXGen(generacion);
    }//GEN-LAST:event_jbtNavegarGenUltimaActionPerformed

    private void txtNavegarGenFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtNavegarGenFocusLost
        // TODO add your handling code here:
        try {
            int generacion = Integer.parseInt(txtNavegarGen.getText());
            if (generacion >= 0 && generacion < AGenApp.getCorrerThead().
                    getIteracion() - Optimo.generacionesCorteOptimo) {
                AGenApp.actualizarGraficoAptitudesXGen(generacion);
            }
        } catch (Exception e) {
            txtNavegarGen.setText("0");
            AGenApp.actualizarGraficoAptitudesXGen(0);
        }
    }//GEN-LAST:event_txtNavegarGenFocusLost

    private void chkGuardarLogActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkGuardarLogActionPerformed
        chkBatch.setEnabled(chkGuardarLog.isSelected());
        chkBatch.setSelected(false);
        txtBatch.setEnabled(chkBatch.isSelected());
        txtBatch.setEditable(chkBatch.isSelected());
    }//GEN-LAST:event_chkGuardarLogActionPerformed

    private void chkBatchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkBatchActionPerformed
        // TODO add your handling code here:
        txtBatch.setEnabled(chkBatch.isSelected());
        txtBatch.setEditable(chkBatch.isSelected());
    }//GEN-LAST:event_chkBatchActionPerformed

    private void txtBatchFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtBatchFocusLost
        // TODO add your handling code here:
        try {
            txtBatch.setText(String.valueOf(Integer.parseInt(txtBatch.getText())));
        } catch (Exception e) {
            txtBatch.setText("100");
        }
    }//GEN-LAST:event_txtBatchFocusLost
    private void setMetodoMutacion(javax.swing.JRadioButton source){
        if (source.equals(btngConvergencia)) {
            metodoMutacion = Mutacion.ADAPTATVA_POR_CONVERGENCIA;
        } else if (source.equals(btngSimple)) {
            metodoMutacion = Mutacion.SIMPLE;
        } else if (source.equals(btngTCre)) {
            metodoMutacion = Mutacion.ADAPTATVA_POR_TEMPERATURA_CRESIENTE;
        } else if (source.equals(btngTDec)) {
            metodoMutacion = Mutacion.ADAPTATVA_POR_TEMPERATURA_DECRESIENTE;
        }
    }
    private void borrarGen(int GenRow) {
        GenesTableModel genesTModel = (GenesTableModel) jtbIGenes.getModel();
        genesTModel.borrarGen(GenRow);
    }

    private void agregarGen(int[] individuoElementosElegidos) {
        GenesTableModel genesTModel = (GenesTableModel) jtbIGenes.getModel();
        genesTModel.agregarGen(individuoElementosElegidos);

    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JRadioButton btngConvergencia;
    private javax.swing.ButtonGroup btngMutacion;
    private javax.swing.JRadioButton btngSimple;
    private javax.swing.JRadioButton btngTCre;
    private javax.swing.JRadioButton btngTDec;
    private javax.swing.JCheckBox chkBatch;
    private javax.swing.JCheckBox chkBuscarEsquema;
    private javax.swing.JCheckBox chkGuardarLog;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JSplitPane jSplitPane3;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JToggleButton jbtCorrer;
    private javax.swing.JButton jbtGenerarMatriz;
    private javax.swing.JButton jbtNavegarGenAdelante;
    private javax.swing.JButton jbtNavegarGenAtras;
    private javax.swing.JButton jbtNavegarGenPrimera;
    private javax.swing.JButton jbtNavegarGenUltima;
    private javax.swing.JButton jbtRandomCompletar;
    private javax.swing.JToggleButton jbtnIncognita;
    private javax.swing.JButton jbtnTodoIncognita;
    private javax.swing.JLabel jlblBinomial;
    private javax.swing.JLabel jlblCoherencia;
    private javax.swing.JLabel jlblCoherenciaDesc;
    private javax.swing.JLabel jlblConvergencia;
    private javax.swing.JLabel jlblConvergenciaDesc;
    private javax.swing.JLabel jlblCortarIteracion;
    private javax.swing.JLabel jlblElitista;
    private javax.swing.JLabel jlblIndiciduoOptimo;
    private javax.swing.JLabel jlblIndividuoOptimoDesc;
    private javax.swing.JLabel jlblIteracion;
    private javax.swing.JLabel jlblIteracionDesc;
    private javax.swing.JLabel jlblMaxPMutacion;
    private javax.swing.JLabel jlblMejorAptitud;
    private javax.swing.JLabel jlblMejorAptitudDesc;
    private javax.swing.JLabel jlblMetodoMutacion;
    private javax.swing.JLabel jlblMinPMutacion;
    private javax.swing.JLabel jlblMultiPunto;
    private javax.swing.JLabel jlblOpCruce;
    private javax.swing.JLabel jlblOpMutacion;
    private javax.swing.JLabel jlblOpSeleccion;
    private javax.swing.JLabel jlblPunto;
    private javax.swing.JLabel jlblRanking;
    private javax.swing.JLabel jlblRuleta;
    private javax.swing.JPanel jplCruce1;
    private javax.swing.JPanel jplEstructura;
    private javax.swing.JPanel jplGraficosApResumen;
    private javax.swing.JPanel jplInfo;
    private javax.swing.JPanel jplMultiCriterio;
    private javax.swing.JPanel jplMutacion;
    private javax.swing.JPanel jplSeleccion;
    private javax.swing.JPanel jplgraficosApXGen;
    private javax.swing.JScrollPane jsclEstructura;
    private javax.swing.JSlider jsldBinomial;
    private javax.swing.JSlider jsldCruce;
    private javax.swing.JSlider jsldElitista;
    private javax.swing.JSlider jsldMultiPunto;
    private javax.swing.JSlider jsldMutacion;
    private javax.swing.JSlider jsldPunto;
    private javax.swing.JSlider jsldRancking;
    private javax.swing.JSlider jsldRuleta;
    private javax.swing.JSlider jsldSeleccion;
    private javax.swing.JScrollPane jspMultiCriterio;
    private javax.swing.JSplitPane jsplConfAG;
    private javax.swing.JTable jtbIGenes;
    private javax.swing.JTable jtbIndividuo;
    private javax.swing.JTable jtbMultiCriterio;
    private javax.swing.JTable jtbMultiPunto;
    private javax.swing.JTabbedPane jtbpAdmin;
    private javax.swing.JTabbedPane jtbpgraficos;
    private javax.swing.JTextField jtxtCortarIteracion;
    private javax.swing.JTextField jtxtCorteEstadistico;
    private javax.swing.JTextField jtxtMaxPMutacion;
    private javax.swing.JTextField jtxtMinPMutacion;
    private javax.swing.JLabel lblAyudaAHP;
    private javax.swing.JLabel lblCantCriterios;
    private javax.swing.JLabel lblEstructura;
    private javax.swing.JLabel lblMejoroAptitud;
    private javax.swing.JLabel lblMejoroAptitudDesc;
    private javax.swing.JLabel lblmanoGenMatriz;
    private javax.swing.JLabel lblmanoIncognita;
    private javax.swing.JLabel lblmanoRandom;
    private javax.swing.JLabel lblmanoTodoIncognita;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JTextField txtBatch;
    private javax.swing.JTextField txtCantCriterios;
    private javax.swing.JTextField txtNavegarGen;
    private javax.swing.JTextField txtPoblacion;
    // End of variables declaration//GEN-END:variables

    public JLabel getJlblIndividuoOptimo() {
        return jlblIndiciduoOptimo;
    }
    // End of variables declaration
    private final Timer messageTimer;
    private final Timer busyIconTimer;
    private final Icon idleIcon;
    private final Icon[] busyIcons = new Icon[15];
    private int busyIconIndex = 0;
    private JDialog aboutBox;
    public JPanel getPanelGraficosApXGen (){
        return jplgraficosApXGen;
    }
    public JTextField getTxtNavegarGeneraciones(){
        return txtNavegarGen;
    }
    public JLabel getLblMejorAptitud(){
        return lblMejoroAptitud;
    }
    private static class AyudaContextual {
        /*El siguiente comentario define el ancho aceptable de linea del label*/
        /*Ayuda Contextual Ayuda Contextual*/

        public static String PASO1_CREAR_MATRIZ = "<html>Establezca la cantidad"
                + " de criterios. Luego haga click en \"Generar Matriz\"</html>";
        public static String PASO2_INCOGNITAS =
                /*Ayuda Contextual Ayuda Contextual*/
                "<html>Precione <b>\"Incognitas\"</b>  para "
                +"selecionar las celdas como  "
                +"incognitas. Luego de seleccionar " +
                "las incognitas, vuelva a precionar <b>\"Incognitas\"</b> para" +
                "que el sistema genere la estructura del individuo.</html>";
        public static String PASO3_COMPLETAR =
                "<html>Establezca valores seleccionando la "
                +"celda y escribiendo el entero o  "
                +"fracción correspondiente. "
                +"También puede precionar <b>\"Random\"</b> "
                +"para completar los lugares  "
                +"vacios con números aleatorios</html>";
        public static String PASO4_CONFIGURACION =
                "<html>En la solapa Configuración AG "
                +"puede configurar los parametros del "
                +"algorítmo. Cuando esté listo puede "
                +"precionar <b>\"Correr\"</b>. </html>";
        public static String PASO5_PAUSA =
                "<html>Ahora puede precionar <b>\"pausa\"</b> para "
                +"detener la ejecución y observar los " +
                "valores actuales.";
        public static String PASO6_CORRER =
                "<html>Vuelva a precionar <b>\"Correr\"</b> para continuar con " +
                "la ejecución del algorítmo.";
    }

}
